package com.yzw.rabbitmq.product;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Athor:Yuan
 * @Date:2020/5/12 17:35
 * Desc:
 */
@RestController
public class SimpleProducer {
    @Autowired
    AmqpTemplate amqpTemplate;

    @RequestMapping(value = "/send",method = RequestMethod.GET)
    public void send(String message){
        amqpTemplate.convertAndSend("mq",message);
        System.out.println("============"+message);
    }
}
